package com.opg.uop.manage.base;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

/**
 * rest接口返回信息包装类，规定了返回信息格式
 * 
 * @author Yang Jiazhi
 * @date 2017/01/11
 */
@JsonInclude(Include.NON_NULL)
public class UOPRestApiResponse {

	public final static String SUCCESS = "200";
	public final static String FAILED = "400";

	private Map<String, Object> meta;
	private Object data;
	private Map<String, Object> error;

	public UOPRestApiResponse() {
		this.meta = new HashMap<>();
		meta.put("code", SUCCESS);
	}

	public UOPRestApiResponse(Map<String, Object> meta, Object data, Map<String, Object> error) {
		this.meta = meta;
		this.data = data;
		this.error = error;
	}

	public Map<String, Object> getMeta() {
		return meta;
	}

	public void setMeta(Map<String, Object> meta) {
		this.meta = meta;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public Map<String, Object> getError() {
		return error;
	}

	public void setError(Map<String, Object> error) {
		this.error = error;
	}

	@Override
	public String toString() {
		return "UOPResponse [meta=" + meta + ", data=" + data + ", error=" + error + "]";
	}

}
